package com.CoreryBlack.Mapper;

import com.CoreryBlack.po.Student;
import com.CoreryBlack.po.StudentQueryParam;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;
import java.util.Map;

/**
 * @Description StudentMapper
 * @Author CoreryBlack
 * @Date 2024-09-19
 */

@Mapper
public interface StudentMapper {

    Page<Student> list(StudentQueryParam studentQueryParam);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into student(name,id_card,clazz_id,gender,phone,degree,violation_count,violation_score,update_time) value " +
    "(#{name},#{idCard},#{clazzId},#{gender},#{phone},#{degree},#{violationCount},#{violationScore},#{updateTime})")
    void insert(Student student);

    void deleteByIds(List<Integer> ids);

    void saveStudent(Student student);

    Student queryById(Integer ids);

    void updateStudent(Student student);

    void updateStudentScore(Integer id, Integer score);

    Student getInfo(Integer id);

    @MapKey("name")
    List<Map> getStudentDegreeData();
}
